package com.greendragon.persistence.enmu; 

import org.apache.commons.lang.StringUtils;

/** 
 * @author wulibin, exceptsky@gmail.com, 2012-1-11 上午09:03:50
 * 
 */
public enum FetchUserType {
	ALL(0,"all"),
	USER(1,"user"),
	ADMIN(2,"admin"),
	BLOCK(3,"block"),
	INACTIVE(4,"inactive");

	private int    index;
    private String name;
   

    private FetchUserType(int index, String name) {
    	this.index = index;
        this.name = name;
    }
    
    public static FetchUserType getByName(String type){
    	if(StringUtils.isEmpty(type)){
    		return FetchUserType.USER;
    	}else if(type.equalsIgnoreCase("user")){
    		return FetchUserType.USER;
    	}else if(type.equalsIgnoreCase("admin")){
    		return FetchUserType.ADMIN;
    	}else if(type.equalsIgnoreCase("block")){
    		return FetchUserType.BLOCK;
    	}else if(type.equalsIgnoreCase("inactive")){
    		return FetchUserType.INACTIVE;
    	}else if(type.equalsIgnoreCase("all")){
    		return FetchUserType.ALL;
    	}else{
    		return FetchUserType.USER;
    	}
    }

	public int getIndex() {
		return index;
	}


	public void setIndex(int index) {
		this.index = index;
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}
    
    
}
 